package club.banyuan;

public class PrintBThread extends Thread {

    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            synchronized (ThreadState.class) {
                while (ThreadState.turn != Turn.B) {
                    try {
                        ThreadState.class.wait();
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }

                System.out.printf("B");
                ThreadState.turn = Turn.C;
                ThreadState.class.notifyAll();
            }
        }
    }
}
